package org.scct.chenhui;

import org.scct.chenhui.dao.BookDao;
import org.scct.chenhui.dao.UserDao;
import org.scct.chenhui.model.BookBean;
import org.scct.chenhui.model.UserBean;
import org.scct.chenhui.utils.DBUtils;

import java.sql.*;
import java.util.List;

// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {
        BookDao bookDao = new BookDao();
        List<BookBean> allBooks = bookDao.getAllBooks();
        for (BookBean allBook : allBooks) {
            System.out.println(allBook);
        }

//        UserDao userDao = new UserDao();
////        UserBean userBean = userDao.Login("demo1", "123456", 1);
////        if(userBean==null)
////        {
////            System.out.println("登录失败");
////        }else{
////            // %s  字符串  %d整数， %.2f  2位的浮点数
////            System.out.println(String.format("欢迎你：%s, 你的电话是：%s",userBean.getUsername(),userBean.getPhone()));
////        }
////        UserBean user = new UserBean();
////        user.setUsername("demo5");
////        user.setPassword("222222");
////        user.setSex("女");
////        user.setRole(1);
////        user.setPhone("16666666666");
////        boolean res = userDao.AddUser(user);
////        if(res)
////        {
////            System.out.println("添加成功");
////        }else{
////            System.out.println("添加失败");
////        }
//        List<UserBean> allUsers = userDao.getAllUsers();
//        for (UserBean allUser : allUsers) {
//            System.out.println(allUser);
//        }

    }
}